﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EntGuayasSLA.BL;
using EntGuayasSLA.BL.Listas;
using EntGuayasSLA.BL.Listas.Criterias;
using Ext.Net;

namespace EGuayas.Web.Licenciamiento.admin.tabs
{

    public partial class pgBorradorFA : pgBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!X.IsAjaxRequest)
                {
                    CloseTabs(TabPanel1,0);
                    string sExpedienteId = GetSessionPage.ExpedienteId(SessionPage.PageLicAdm);
                    Expediente expObjNow = Expediente.GetEditableRoot(Guid.Parse(sExpedienteId));
                    //Según categoria vizualizar tabs
                    if (expObjNow.Categoria == Constantes.FaseConfigBF1 || expObjNow.Categoria == Constantes.FaseConfigBF2)
                    {
                        this.btnExp.Show();
                        ComponentLoader myLoader2 = new ComponentLoader();
                        myLoader2.Mode = LoadMode.Frame;
                        myLoader2.Url = "pgTipoExPostExtPost.aspx?idExp=" + Session[SessionPage.PageLicAdm + Constantes.Expediente];
                        TabBorFicAmbCong.Loader = myLoader2;
                        //TabTdrCong
                        this.TabPanel1.ShowTab("TabBorFicAmbCong");
                    }
                    else
                    {
                        //this.TabPanel1.CloseTab(0, CloseAction.Hide);
                        this.TabPanel1.SetActiveTab(0);
                        this.btnExp.Hide();

                    }
                }
            }
            catch (Exception ex)
            {
                RegistrarLog(ex);
            }
        }
        
        #region Documentos Licenciamiento
        /// <summary>
        /// Documentos correguir
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OnCorreguirDocCategoriaAdded(object sender, ComponentAddedEventArgs e)
        {
            try
            {
            Ext.Net.Panel panel = (Ext.Net.Panel)e.Control;
            SetCustomConfigWucLicAll(panel, SessionPage.PageLicAdm, Constantes.LBorradorFicha);
            }
            catch (Exception ex)
            {
                RegistrarLog(ex);
            }
           
        }
        
        #endregion
        #region Tarea
        /// <summary>
        /// Inicializar constante de Borrardor
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OnTareasTdrAdded(object sender, ComponentAddedEventArgs e)
        {
            try
            {
            Ext.Net.Panel panel = (Ext.Net.Panel)e.Control;
            SetCustomConfigWucLicAll(panel, SessionPage.PageLicAdm, Constantes.LBorradorFicha);
            }
            catch (Exception ex)
            {
                RegistrarLog(ex);
            }
          
        }
        #endregion
        #region Informe
        /// <summary>
        /// Informes
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OnInformeCorrecionTdrAdded(object sender, ComponentAddedEventArgs e)
        {
            try
            {
                 Ext.Net.Panel panel = (Ext.Net.Panel)e.Control;
                 SetCustomConfigWucLicInforme(panel, SessionPage.PageLicAdm, Constantes.LBorradorFicha, Valores.Modulo_Archivo_Informes_Licenciamiento);
            }
            catch (Exception ex)
            {
                RegistrarLog(ex);
            }
        }
        #endregion
    }
}